package model

import (
	"poker/db"

	"go.mongodb.org/mongo-driver/bson"
)

type Girl struct {
	GID   string `json:"gid" bson:"gid" binding:"required"`
	Score int64  `json:"score" bson:"score"`
	AppID string `json:"appid" bson:"appid"`
}

type Girl2 struct {
	GID   string `json:"gid" bson:"gid" binding:"required"`
	Score int64  `json:"score" bson:"score"`
}

func (u *Girl) FindOne(col string, filter interface{}) error {
	return db.FindOne(col, filter, u)
}

func (u *Girl) Save(col string, filter interface{}) error {
	update := bson.M{"$set": bson.M{"gid": u.GID, "appid": u.AppID, "score": u.Score}}
	return db.UpdateOne(col, filter, update)
}
